import os
import sys

class Config:
    if hasattr(sys, '_MEIPASS'):
        BASEDIR = os.path.join(os.path.expanduser('~'), '.jizhang')
    else:
        BASEDIR = os.path.abspath(os.path.dirname(__file__))
    os.makedirs(BASEDIR, exist_ok=True)
    SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASEDIR, 'db.sqlite3')
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    MAIL_SERVER = 'smtp.qq.com'
    MAIL_PORT = 587
    MAIL_USE_TLS = True
    MAIL_USERNAME = os.getenv('MAIL_USERNAME')
    MAIL_PASSWORD = os.getenv('MAIL_PASSWORD')
    MAIL_DEFAULT_SENDER = os.getenv('MAIL_USERNAME')
